<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/jsp/common.jsp"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<%@ include file="/WEB-INF/jsp/importHead.jsp"%>
<%@ include file="/WEB-INF/jsp/importCommonCss.jsp"%>
<link rel="stylesheet" type="text/css" href="${basePath }/css/index-old.css" />
</head>
<style>
	body.met-navfixed {
		margin: 0 auto;
		padding: 0;
		height: 100%;
		padding-top: 65px;min-height: 595px;
	}
	
	html {
		margin: 0 auto;
		padding: 0;
		height: 100%;
		min-height: 595px;
		position: relative;
	}
	
	html, body {
		margin: 0px;
		height: 100%;
	}
	
	body.met-navfixed>section.notice_list_met_11_1 {
		visibility: inherit;
		opacity: 1;
		transform: matrix(1, 0, 0, 1, 0, 0);
		background-color: #F5F5F5;
		height: calc(100% - 90px);
	}

	body.met-navfixed>section.notice_list_met_11_1 div.container.notice {
		height: auto;
		line-height: normal;
	}
	
	div.form-group>label.form-control-label{
		height: auto;
		line-height: normal;
	}
	
	footer.foot_info_met_16_1{
		background-color: #F5F5F5;position: absolute;width: 100%;bottom: 0;
	}
</style>
<body class="met-navfixed">

	<header class="head_nav_met_11_5-header navbar-fixed-top navbar-shadow" m-id="1" m-type="head_nav">
  <nav class="navbar navbar-default box-shadow-none head_nav_met_11_5" style="border-bottom: solid 2px #4ca8d8;padding-bottom: 10px;">
    <div class="container">
      <div class="row">
        <a href="${basePath}" class="met-nav-logo" title="${webSite.name}" style="opacity: 1;visibility: visible;">
          <h1 hidden="">${company.companyName}</h1>
          <div class="vertical-align-middle">
            <img src="${basePath}${webSite.logoPath}" alt="${webSite.name}" /></div>
        </a>
        <div class="collapse navbar-collapse navbar-collapse-toolbar pull-md-left p-0" id="met-nav-collapse">
          <div style="margin: 13px 0 0 15px;border-left: solid 2px #dadada;height: 47px;width: 0px;overflow:  hidden;float: left;"></div>
          <ul class="nav navbar-nav navlist" style="margin-left: 44px;">
            <li class="nav-item">
              <h3 style="color: #7b8082;line-height: 70px !important;">登录</h3>
            </li>
          </ul>
        </div>
      </div>
    </div>
  </nav>
</header>
	
	<section class="notice_list_met_11_1 text-xs-left" m-id="4">
	<div class="container notice clearfix" style="height: 100%;min-height: 440px;max-height: 740px;min-width: 600px;">
		<div class="col-xs-6" style="max-height: 650px;">
			<img style="width: 100%;" src="${basePath }/images/loginImage.jpg" />
		</div>
		<div class="col-xs-6" style="padding: 80px 20px;height: 100%;">
			<form role="form" action="${basePath }/login2" method="post" class="form-horizontal container" id="login-form" style="position: relative;height: 100%;">
				<div class="container-fluid form-group">
					<label class="col-xs-3 form-control-label">用户名：</label>
					<div class="col-xs-9">
						<input type="text" id="form-username" name="loginName" placeholder="电子邮箱/手机号/用户名" autocomplete="off" value="" class="form-control" />
					</div>
				</div>
				<div class="container-fluid form-group">
					<label class="col-xs-3 form-control-label">密&nbsp;&nbsp;&nbsp;&nbsp;码：</label>
					<div class="col-xs-9">
						<input id="password" type="password" name="password" placeholder="请输入密码" autocomplete="off" class="form-control" />
					</div>
				</div>
				<div class="container-fluid">
					<div class="col-xs-3">
					</div>
					<div class="col-xs-3">
						<div class="checkbox-custom" style="word-break: keep-all;">
							<input id="chk11" type="checkbox" name="remember_me" class="" />
							<label class="checkbox" for="chk11" style="height: auto;line-height: normal;">
								记住用户名
							</label>
						</div>
					</div>
					<div class="col-xs-6 text-xs-right">
						<div style="word-break: keep-all;padding-left: 20px;padding-top: .8rem;">
							<a href="${basePath }/changPasswordStart" style="color: #e3b09f;">忘记密码？</a>
						</div>
					</div>
				</div>
				
				<div class="container-fluid form-group hide login-error">
					<label class="col-xs-12 form-control-label" style="color: red;text-align: center;">${ErrorCode }</label>
				</div>
				
				<div class="container-fluid" style="margin: 0 auto;clear: both;float: none;position:absolute;bottom: 0;width: 100%;">
					<div class="col-xs-8 col-md-7 col-lg-6" style="margin: 0 auto;clear: both;float: none;">
						<button class="btn btn-block" type="submit" style="background: #0075c1;color: #fff;sborder-radius: 5px;">登  录</button>
						<div style="width: 100%;padding: 20px 0;text-align: center;">
							没有账户？<a href="${basePath }/register">马上注册</a>
						</div>
					</div>
				</div>
				
				<c:if test="${onlyCollection eq true or onlyCollection eq 'true'}">
					<input type="hidden" name="onlyCollection" value="${onlyCollection }" />
				</c:if>
			</form>
		</div>
	</div>
	</section>
	
	<%@ include file="/WEB-INF/jsp/importFooter.jsp"%>
	<%@ include file="/WEB-INF/jsp/importCommonJS.jsp"%>
	
	<script>
	jQuery(document).ready(function() {
		if(getCookie("rememberme") == "true"){
			$("#chk11").attr("checked", true);
			if(getCookie("username")){
				$("#form-username").val(getCookie("username"));
				$("#password").val(getCookie("password"));
			}
		}
		
		var $loginForm = $('#login-form');
		var $field = $loginForm.find('input[type="text"], input[type="password"], textarea');

		/*
		    Form validation
		*/

		var loginError = '${loginError}';
		
		if (loginError === true || loginError === 'true') {
			$(".login-error").removeClass("hide");
		} else {
			$(".login-error").addClass("hide");
		}

		$field.on('focus', function() {
			$(".login-error").addClass("hide");
		});

		$loginForm.on('submit', function(e) {

			$field.each(function() {
				if ($(this).val().replace(/\s/g, "").length == 0) {
					e.preventDefault();
					$(".login-error").find("label").html("帐号或者密码不能为空");
					$(".login-error").removeClass("hide");
				} else {
					$(".login-error").addClass("hide");
				}
			});

			if ($(".login-error").is(":hidden")) {
				
				if($("#chk11").is(':checked')){
					setCookie("rememberme","true",365);
					if(!getCookie("username")){
						setCookie("username",$("#form-username").val(),365);
						setCookie("password",$("#password").val(),365);
					}
				}
				else{
					setCookie("rememberme","false",365);
					setCookie("username","",365);
					setCookie("password","",365);
				}
			}
		});
	});
	</script>
</body>
</html>
